<template>
	<view>
		<view class="c-box-nobg">
			<u-image :src="detail.mapUrl" height="300rpx" width="100%" @click="preview"></u-image>
		</view>
		<view class="c-box-nobg fs26">
			<view class="fl jsp">
				<h4>{{detail.name}}</h4>
				<view class="fl jed" :class="detail.businessState==1?'t-gr':'t-r'">
					{{detail.businessState==1?'营业中':'未营业'}}
				</view>
			</view>
			<view class="fl">
				<u-icon name="map"></u-icon>
				<text>{{detail.address}}</text>
			</view>
			<view class="fl">
				<u-icon name="clock"></u-icon>
				<text>{{detail.businessHours}}</text>
			</view>
		</view>
		<view class="c-box-nobg">
			<u-divider text="图书馆介绍"></u-divider>
		</view>
		<view class="c-box-nobg fs26">
			{{detail.description}}
		</view>
	</view>
</template>

<script setup>
	import {onLoad} from '@dcloudio/uni-app'
import { ref ,getCurrentInstance} from 'vue';
import { getDetailAPI } from '../../../api/library';
	const detail =ref({})
	const id = ref()
	const {proxy} =getCurrentInstance()
	const getDetail=async ()=>{
		const res =await getDetailAPI(id.value)
		detail.value =res.data
		detail.value.mapUrl =proxy.$http + detail.value.mapUrl.replace('/dev-api/','/prod-api/')
	}
	const preview=()=>{
		uni.previewImage({
			urls:[detail.value.mapUrl]
		})
	}
	onLoad((options)=>{
		id.value =options.id
		getDetail()
	})
</script>

<style>

</style>
